﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Model;
using System.Xml;

namespace DAL
{
    public class RepositoryBase
    {
        protected Object thisLock = new Object();
        protected static string basicPath = AppDomain.CurrentDomain.BaseDirectory;
        protected string xmlPath;
        protected XmlDocument xmlDoc = new XmlDocument();
        protected XmlNode xmlRoot;
        protected void LoadXML()
        {

            if (string.IsNullOrEmpty(xmlPath) || null == xmlDoc)
            {
                return;
            }

            xmlDoc.Load(xmlPath);
            xmlRoot = xmlDoc.SelectSingleNode(ModelBase.ROOT);
        }

        protected void SaveXML()
        {

            if (string.IsNullOrEmpty(xmlPath) || null == xmlDoc)
            {
                return;
            }

            xmlDoc.Save(xmlPath);
        }
    }
}
